package day3;
//测试HashCode
public class Demo1 {
    public static void main(String[] args) {
        //属于Object类的hashcode
        Demo1 d1=new Demo1();
        System.out.println("d1:"+d1.hashCode());
        Demo1 d2=new Demo1();
        Demo1 d3=d1;
        System.out.println("d2:"+d2.hashCode());
        System.out.println("d3:"+d3.hashCode());

        //Integer类的hashCode
        Integer num1=1000;
        Integer num2=new Integer(100000);
        Double d=100.0;
        Float f=15.5f;
        System.out.println("d:"+d.hashCode());
        System.out.println("f:"+f.hashCode());
        System.out.println("num1:"+num1.hashCode());
        System.out.println("num2:"+num2.hashCode());
        //String类hashcode
        String s1="java";
        String s2=new String("java");
        System.out.println("s1:"+s1.hashCode());
        System.out.println("s2:"+s2.hashCode());
    }
}
